import 'package:aichat_flutter_wallet/module_common/utils/colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ErrorTipWidget extends StatelessWidget {
  final String tips;
  final Function? onClose;
  final canClose;
  const ErrorTipWidget({super.key, this.tips = '', this.onClose, this.canClose = true});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
      decoration: BoxDecoration(color: AppColors.c_FFF8F1, borderRadius: BorderRadius.circular(10.w)),
      child: Row(
        children: [
          Image(
            image: AssetImage('assets/images/dapp/warn.png'),
            width: 20.w,
            height: 20.w,
          ),
          SizedBox(
            width: 10.w,
          ),
          Expanded(
            child:
                Text(tips, style: TextStyle(color: AppColors.c_FF5100, fontWeight: FontWeight.w400, fontSize: 12.sp)),
          ),
          if (canClose)
            GestureDetector(
              onTap: () {
                if (onClose != null) {
                  onClose!();
                }
              },
              child: Image(
                image: AssetImage('assets/images/dapp/error.png'),
                width: 20.w,
                height: 20.w,
              ),
            ),
        ],
      ),
    );
  }
}
